﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="Cadastros_Turma" Codebehind="Turma.aspx.cs" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<%@ Register src="../Usercontrol/wuscSeguranca.ascx" tagname="wuscSeguranca" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Qvaliz.CTM.Inspeções</title>
    
    <script type="text/javascript">

        //      função para inserir turma
        function OpenWnd() {
            $find("turma_id").set_value("");
            $find("tur_descricao").set_value("");
            $find("modalidade_id").set_text("");
            $find("sala_id").set_value("");
            $find("turno_id").set_text("");
            $find("nivel_id").set_value("");

            window.radopen("Turma_cadastro.aspx?operacao=insert", "wndInsert");
            return false;
        }

        //      função para editar turma
        function ShowEditForm(id, rowIndex) {

            window.radopen("Turma_cadastro.aspx?operacao=edit&TURMA_ID=" + id, "wndEdit");
            return false;
        }

        //      função exibir Auditoria
        function ShowAuditoria(id, rowIndex) {

            window.radopen("Auditoria.aspx?operacao=select&interface=TURMA&interface_id=" + id, "wndAuditoria");
            return false;
        }

        //      função exibir Alunos Matriculados 
        function ShowAlunosTurma(id, rowIndex) {

            window.radopen("../Matriculas/Aluno_matricula.aspx?operacao=select&turma_id=" + id, "wndAlunosTurma");
            return false;
        }

        //      função para tratar duplo click no grid
        function RowDblClick(sender, eventArgs) {
            window.radopen("Turma_cadastro.aspx?operacao=edit&TURMA_ID=" + eventArgs.getDataKeyValue("TURMA_ID"), "wndEdit");
        }

        //      função para carregar o grid via panel ajax
        function LoadGrid() {
            $find("rapGrid").ajaxRequest("load");
        }

        //      função para tratar o evento CLOSE de RadWindow via Clientside EDIT
        function OnClientClose() {
            $find("rapGrid").ajaxRequest("load");
        }

        //      função para tratar o evento CLOSE de RadWindow via Clientside INSERT
        function OnClientCloseInsert(oWnd, args) {
            //  obter os parametros transferidos pelo Pop-up
            var arg = args.get_argument();
            if (arg) {
                $find("turma_id").set_value(arg.diretivaID);
                $find("rapGrid").ajaxRequest("load");
            }
        }

        //      função para EXCLUIR o Material
        function WndDelete(id, rowIndex) {

            window.radopen("../Administracao/Excluir_registro.aspx?operacao=delete&interface=TURMA&interface_id_value=" + id, "wndRemover");
            return false;
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
     <asp:ObjectDataSource ID="ods_Turma" runat="server"  
        SelectMethod="_obter_Turma" TypeName="Banco.BD_Turma" 
         onselecting="ods_Material_Selecting"> 
        <SelectParameters> 
            <asp:Parameter Name="TURMA_ID" Type="String" /> 
            <asp:Parameter Name="MODALIDADE_ID" Type="String" /> 
            <asp:Parameter Name="SALA_ID" Type="String" /> 
            <asp:Parameter Name="TURNO_ID" Type="String" /> 
            <asp:Parameter Name="NIVEL_ID" Type="String" /> 
            <asp:Parameter Name="TUR_DESCRICAO" Type="String" /> 
            <asp:Parameter Name="TUR_DTCRIACAO" Type="String" />
            <asp:Parameter Name="TUR_DTFORMACAO" Type="String" />
            <asp:Parameter Name="TUR_DTFECHAMENTO" Type="String" />
            <asp:Parameter Name="TUR_MODALIDACOBRANCA" Type="String" />
            <asp:Parameter Name="TUR_QTMENSALIDADES" Type="String" />
            <asp:Parameter Name="TUR_STEXCLUIDO" Type="String" />
            <asp:Parameter Name="ORDER_BY_CLAUSE" Type="String" />
        </SelectParameters> 
    </asp:ObjectDataSource> 

    <asp:ObjectDataSource ID="ods_Modalidade" runat="server" 
        SelectMethod="_obter_Modalidade" 
         TypeName="Banco.BD_Modalidade">
        <SelectParameters>
            <asp:Parameter Name="MODALIDADE_ID" Type="String" />
            <asp:Parameter Name="MOD_DESCRICAO" Type="String" />
            <asp:Parameter Name="MOD_EXCLUIDO" Type="String" />
            <asp:Parameter Name="ORDER_BY_CLAUSE" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>

    <asp:ObjectDataSource ID="ods_Sala" runat="server" 
        SelectMethod="_obter_Sala" 
         TypeName="Banco.BD_Sala">
        <SelectParameters>
            <asp:Parameter Name="SALA_ID" Type="String" />
            <asp:Parameter Name="SAL_DESCRICAO" Type="String" />
            <asp:Parameter Name="SAL_EXCLUIDO" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>

    <asp:ObjectDataSource ID="ods_Turno" runat="server" 
        SelectMethod="_obter_Turno" 
         TypeName="Banco.BD_Turno">
        <SelectParameters>
            <asp:Parameter Name="TURNO_ID" Type="String" />
            <asp:Parameter Name="TUR_DESCRICAO" Type="String" />
            <asp:Parameter Name="TUR_EXLUIDO" Type="String" />
            <asp:Parameter Name="ORDER_BY_CLAUSE" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>

    <asp:ObjectDataSource ID="ods_Nivel" runat="server" 
        SelectMethod="_obter_Nivel" 
         TypeName="Banco.BD_Nivel">
        <SelectParameters>
            <asp:Parameter Name="NIVEL_ID" Type="String" />
            <asp:Parameter Name="NIV_DESCRICAO" Type="String" />
            <asp:Parameter Name="ST_EXCLUIDO" Type="String" />
            <asp:Parameter Name="ORDER_BY_CLAUSE" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
      
    <uc1:wuscSeguranca ID="wuscSeguranca1" runat="server" />

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" AutoSize="false"
         ShowContentDuringLoad="False" Skin="Sunset" 
        EnableShadow="true" ReloadOnShow="True" Animation="Resize" 
        AnimationDuration="200" Modal="True">
            <Windows>
                <telerik:RadWindow ID="wndEdit" runat="server" Title="Editar Turma" Height="370px"
                    Width="850px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    OnClientClose="OnClientClose" VisibleStatusbar="False"/>
                 <telerik:RadWindow ID="wndInsert" runat="server" Title="Inserir nova Turma" Height="370px"
                    Width="850px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    OnClientClose="OnClientClose" VisibleStatusbar="False"/>
                <telerik:RadWindow ID="wndAlunosTurma" runat="server" Title="Alunos Matriculados" Height="370px"
                    Width="850px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    VisibleStatusbar="False"/>
                <telerik:RadWindow ID="wndAuditoria" runat="server" Title="Auditoria" Height="370px"
                    Width="850px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    VisibleStatusbar="False"/>
                <telerik:RadWindow ID="wndRemover" runat="server" Title="Excluir Registro" Height="320px"
                    Width="495px" Left="500px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" Behavior="Close, Pin, Move, Reload"
                    OnClientClose="OnClientClose" VisibleStatusbar="False"/>
            </Windows>
    </telerik:RadWindowManager>

    <table width="100%">
        <tr>
            <td>               
                <div style="float:left; margin-left:0px; width:10%">
                    <asp:Label ID="lbl_turma_id" runat="server" Text="Código Interno" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadNumericTextBox ID="turma_id" runat="server" Font-Size="X-Small"
                                Width="97%" DataType="System.Int32" ReadOnly="false">
                                <NumberFormat DecimalDigits="0" />
                                <ReadOnlyStyle BackColor="#CCCCCC" />
                    </telerik:RadNumericTextBox>                
                </div>
                <div style="float:left; margin-left:14px; width:15%">
                    <asp:Label ID="lbl_tur_descricao" runat="server" Text="Descrição" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadTextBox ID="tur_descricao" Runat="server" Font-Size="X-Small" 
                        MaxLength="200"
                        Width="97%">
                    </telerik:RadTextBox>                
                </div>
                <div style="float:left; margin-left:14px; width:15%">
                    <asp:Label ID="lbl_modalidade_id" runat="server" Text="Modalidade" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadComboBox ID="modalidade_id" runat="server" 
                                    Font-Size="X-Small" Width="100%" DataTextField="MOD_DESCRICAO" 
                                    DataValueField="MODALIDADE_ID" Filter="Contains" 
                                    EmptyMessage="Selecione" MarkFirstMatch="True" 
                                    EnableLoadOnDemand="True" onitemsrequested="modalidade_id_ItemsRequested" 
                                    style="margin-bottom: 0px">                        
                    </telerik:RadComboBox>                    
                </div>
                <div style="float:left; margin-left:14px; width:8%">
                    <asp:Label ID="lbl_sala_id" runat="server" Text="Sala" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadComboBox ID="sala_id" runat="server" 
                                    Font-Size="X-Small" Width="100%" DataTextField="SAL_DESCRICAO" 
                                    DataValueField="SALA_ID" Filter="Contains" 
                                    EmptyMessage="Selecione" MarkFirstMatch="True" 
                                    EnableLoadOnDemand="True" onitemsrequested="sala_id_ItemsRequested" 
                                    style="margin-bottom: 0px">                        
                    </telerik:RadComboBox>                    
                </div>
                <div style="float:left; margin-left:14px; width:8%">
                    <asp:Label ID="lbl_turno_id" runat="server" Text="Horário" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadComboBox ID="turno_id" runat="server" 
                                    Font-Size="X-Small" Width="100%" DataTextField="TUR_DESCRICAO" 
                                    DataValueField="TURNO_ID" Filter="Contains" 
                                    EmptyMessage="Selecione" MarkFirstMatch="True" 
                                    EnableLoadOnDemand="True" onitemsrequested="turno_id_ItemsRequested" 
                                    style="margin-bottom: 0px">                        
                    </telerik:RadComboBox>                    
                </div>
                <div style="float:left; margin-left:14px; width:15%">
                    <asp:Label ID="lbl_nivel_id" runat="server" Text="Nível" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadComboBox ID="nivel_id" runat="server" 
                                    Font-Size="X-Small" Width="100%" DataTextField="NIV_DESCRICAO" 
                                    DataValueField="NIVEL_ID" Filter="Contains" 
                                    EmptyMessage="Selecione" MarkFirstMatch="True" 
                                    EnableLoadOnDemand="True" onitemsrequested="nivel_id_ItemsRequested" 
                                    style="margin-bottom: 0px">                        
                    </telerik:RadComboBox>                    
                </div>
                <div style="float:left; margin-left:14px; width:10%">
                    <asp:Label ID="lbl_orderBy" runat="server" Text="Ordernar por" Font-Bold="True" 
                        Font-Size="X-Small"></asp:Label>
                    <telerik:RadComboBox ID="rcb_orderBy" runat="server" 
                                    Font-Size="X-Small" Width="100%" Filter="Contains" 
                                    EmptyMessage="Selecione" MarkFirstMatch="True" 
                                    EnableLoadOnDemand="True" 
                                    style="margin-bottom: 0px">
                        <Items>
                            <telerik:RadComboBoxItem runat="server" />
                            <telerik:RadComboBoxItem runat="server" Text="CÓDIGO" 
                                Value="TURMA.TURMA_ID" Font-Size="X-Small" />
                            <telerik:RadComboBoxItem runat="server" Text="TURMA" 
                                Value="TURMA.TUR_DESCRICAO" Font-Size="X-Small" />
                            <telerik:RadComboBoxItem runat="server" Text="MODALIDADE" 
                                Value="MODALIDADE.MOD_DESCRICAO" Font-Size="X-Small" />                            
                            <telerik:RadComboBoxItem runat="server" Text="SALA" 
                                Value="SALA.SAL_DESCRICAO" Font-Size="X-Small" />

                            <telerik:RadComboBoxItem runat="server" Text="TURNO" 
                                Value="TURNO.TUR_DESCRICAO" Font-Size="X-Small" />
                            <telerik:RadComboBoxItem runat="server" Text="NÍVEL" 
                                Value="NIVEL.NIV_DESCRICAO" Font-Size="X-Small" />
                        </Items>
                    </telerik:RadComboBox>                    
                </div>
                <div style="float:left; margin-left:14px; width:20px">
                    <asp:Label ID="lblsaltoPagina" runat="server" Text="." Font-Bold="True" 
                        Font-Size="X-Small" ForeColor="White"></asp:Label>             
                    <asp:ImageButton ID="imgbConsultar" runat="server" 
                        ImageUrl="~/Imagens/pagina_lupa_cinza.png" 
                        ToolTip="Localizar" onclientclick="LoadGrid(); return false;" />
                               
                </div>

                <div style="float:right; margin-right:0px; width:20px">
                    <asp:Label ID="lblsaltoPagina2" runat="server" Text="." Font-Bold="True" 
                        Font-Size="X-Small" ForeColor="White"></asp:Label>             
                    <asp:ImageButton ID="imgbIncluir" runat="server" 
                        ImageUrl="~/Imagens/pagina_insert_cinza.png" 
                        onclientclick="OpenWnd();return false;" ToolTip="Inserir novo registro" />
                               
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
                 </telerik:RadScriptManager>                                  

                  <telerik:RadAjaxLoadingPanel ID="ralpGrid" runat="server" Skin="Default">
                </telerik:RadAjaxLoadingPanel>

                <telerik:RadAjaxPanel ID="rapGrid" runat="server" Height="430px" 
                    Width="100%" HorizontalAlign="NotSet" LoadingPanelID="ralpGrid" 
                    onajaxrequest="rapGrid_AjaxRequest">
                 <telerik:RadGrid ID="rdg_Turma" runat="server" 
                    AutoGenerateColumns="False"  PageSize="15" Height="430px"
                    GridLines="None" Skin="Sunset" Width="100%" AllowPaging="True" 
                    Font-Size="X-Small" 
                    onselectedindexchanged="rdg_Turma_SelectedIndexChanged" 
                    onitemcreated="rdg_Turma_ItemCreated">
                    <ClientSettings>
                        <Selecting AllowRowSelect="True" />
                        <ClientEvents OnRowDblClick="RowDblClick" />
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                    </ClientSettings>
                    <MasterTableView CommandItemDisplay="Top" 
                         ClientDataKeyNames="TURMA_ID" DataKeyNames="TURMA_ID">
                        <CommandItemSettings ExportToExcelText="Exportar para Excel" 
                            ExportToPdfText="Exportar para PDF" ShowAddNewRecordButton="False" 
                            ShowExportToExcelButton="True" ShowExportToPdfButton="True" />

<%--<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>--%>

<%--<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>--%>
                        <Columns>
            <telerik:GridBoundColumn DataField="TURMA_ID" HeaderText="Código"  
                UniqueName="TURMA_ID"> 
                <HeaderStyle Width="60px" /> 
                <ItemStyle Font-Size="X-Small" Width="60px" /> 
            </telerik:GridBoundColumn> 
            
            <telerik:GridBoundColumn DataField="TUR_DESCRICAO" HeaderText="Descrição"  
                UniqueName="TUR_DESCRICAO"> 
                <HeaderStyle /> 
                <ItemStyle Font-Size="X-Small" /> 
            </telerik:GridBoundColumn> 

            <telerik:GridBoundColumn DataField="MOD_DESCRICAO" HeaderText="Modalidade"  
                UniqueName="MOD_DESCRICAO"> 
                <HeaderStyle Width="120px"  /> 
                <ItemStyle Font-Size="X-Small" Width="120px" /> 
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="NIV_DESCRICAO" HeaderText="Nível"  
                UniqueName="NIV_DESCRICAO"> 
                <HeaderStyle Width="100px" HorizontalAlign="Center"/> 
                <ItemStyle Font-Size="X-Small" Width="100px" HorizontalAlign="Center"/> 
            </telerik:GridBoundColumn>  

            <telerik:GridBoundColumn DataField="SAL_DESCRICAO" HeaderText="Sala"  Visible="false"
                UniqueName="SAL_DESCRICAO"> 
                <HeaderStyle HorizontalAlign="Center" Width="85px" /> 
                <ItemStyle  HorizontalAlign="Center" Font-Size="X-Small" Width="85px" /> 
            </telerik:GridBoundColumn> 

            <telerik:GridBoundColumn DataField="TURNO_DESCRICAO" HeaderText="Horário"  
                UniqueName="TURNO_DESCRICAO"> 
                <HeaderStyle Width="90px" HorizontalAlign="Center"/> 
                <ItemStyle Font-Size="X-Small" Width="90px" HorizontalAlign="Center"/> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="TURNO_ALTER_DESCRICAO" HeaderText="Horário alter."  
                UniqueName="TURNO_ALTER_DESCRICAO"> 
                <HeaderStyle Width="90px" HorizontalAlign="Center"/> 
                <ItemStyle Font-Size="X-Small" Width="90px" HorizontalAlign="Center"/> 
            </telerik:GridBoundColumn> 


            

            <telerik:GridBoundColumn DataField="USU_NOME" HeaderText="Professor"  Visible="true"
                UniqueName="USU_NOME"> 
                <HeaderStyle HorizontalAlign="Center" Width="115px" /> 
                <ItemStyle  HorizontalAlign="Center" Font-Size="X-Small" Width="115px" /> 
            </telerik:GridBoundColumn> 

            <telerik:GridBoundColumn DataField="TUR_TOTALMATRICULA" HeaderText="Alunos"  
                UniqueName="TUR_TOTALMATRICULA"> 
                <HeaderStyle HorizontalAlign="Center" Width="65px" /> 
                <ItemStyle  HorizontalAlign="Center" Font-Size="X-Small" Width="65px" /> 
            </telerik:GridBoundColumn> 
            <telerik:GridCheckBoxColumn DataField="TUR_STEXCLUIDO" HeaderText="Inativo" UniqueName="TUR_STEXCLUIDO" 
                                        AllowFiltering="false">
                                    <HeaderStyle HorizontalAlign="Center" Width="55px" /> 
                                    <ItemStyle HorizontalAlign="Center" Width="55px" /> 
                                </telerik:GridCheckBoxColumn>                                  
            <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Opções">
                <ItemTemplate>
                    <asp:ImageButton ID="imgGridEditar" runat="server" 
                        ImageUrl="~/Imagens/grid_edit.png" ToolTip="Editar dados do Material" />                                    
                    <asp:ImageButton ID="imgGridAlunosadquirentes" runat="server" 
                        ImageUrl="~/Imagens/grid_user.png" ToolTip="Alunos Matriculados" />
                    <%--<asp:ImageButton ID="imgbGridPNAplicavel" runat="server" 
                        ImageUrl="~/Imagens/grid_engine.png" ToolTip="Part Numbers/Modelos Aplicáveis" />--%>
                    <asp:ImageButton ID="imgbGridAuditoria" runat="server" 
                        ImageUrl="~/Imagens/grid_audit.png" ToolTip="Auditoria" />
                    <asp:ImageButton ID="imgbGridExcluir" runat="server" 
                        ImageUrl="~/Imagens/grid_delete.png" ToolTip="Excluir" />
                </ItemTemplate>
                <HeaderStyle Width="95px" />
                <ItemStyle HorizontalAlign="Center" Width="95px"/>
            </telerik:GridTemplateColumn>
        </Columns>

<EditFormSettings>
<%--<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>--%>
</EditFormSettings>
                    </MasterTableView>

<FilterMenu EnableImageSprites="False"></FilterMenu>

<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Sunset"></HeaderContextMenu>
                </telerik:RadGrid>
        </telerik:RadAjaxPanel>
            </td>
        </tr>
                            
    </table>

    </form>
</body>
</html> 

